﻿
function isNumber82(str)
{
    str = ""+str;
    
    var result = false;
    var temp ;
    if(str && typeof str == 'string' && !isNaN(str))
    {
        if(str.indexOf('.') == -1)
        {
            result = str.length>8 ? false:true;
        }
        else
        {
            temp = str.split('.');
            if(temp[0].length <= 8 && temp[1].length <= 2)
            {
                result = true;
            }
            else
            {
                result = false;
            }
        } 
    }
    return result;
}

//////////////////////////////////////////////////////////
function initHeadTitle(baseTitle, newValues) {
	newValues = newValues ? newValues : ['新增', '查看', '修改'];
	if (newValues.length != 3) return;
	if (!baseTitle) {
		if (document.title.indexOf(newValues[0]) == -1) return;
		baseTitle = document.title.substring(0,document.title.indexOf(newValues[0]));
	}
	if (sc) {
		if (sc.isAdd()) {
			document.title = baseTitle + newValues[0];
		} else if (sc.isView()) {
			document.title = baseTitle + newValues[1];
		} else if (sc.isUpdate()) {
			document.title = baseTitle + newValues[2];
		}
	}
}


function validate_grid(grid, keys) {
  var records = grid.el.store.data.items;
  if (records.length == 0 || records.length === undefined) {
    Ext.Msg.alert('注意', '请录入' + grid.title + '数据');
    return false;
  }

  var cols = grid.bindRelation.col;
  var keys = keys ? keys : [];
  
  if (keys.length == 0) {
      Ext.each(cols, function(el) {
          keys.push(el.dataIndex);
      });
  }

  var flag = true;
  Ext.each(records, function(el) {
      for (var i = 0; i < keys.length; i++) {
	if (el.data[keys[i]] === "" || el.data[keys[i]] === undefined) {
	  flag = false;
	}
      }
    });
  if (!flag) {
    Ext.Msg.alert('注意', '请录入' + grid.title + '数据');
  }
  return flag;
}
///////////////////////////////////////////////////////////



//==========================================================================================================================
//一些关于日期处理的公共方法，暂时封装在这里
//==========================================================================================================================
    function GetFirstWeek(year,month){
      return (new Date(year,month-1,1)).getDay()
    }
    function GetThisDays(year,month){
      return (new Date(year,month,0)).getDate()
    }
    function GetLastDays(year,month){
      return (new Date(year,month-1,0)).getDate()
    }
    function FullNumber(num){
      return (parseInt(num,10)<10)?"0"+num:""+num;
    }


    function GetAppointedMonthCalendar(year,month,day){
    
      var _year=(year==null)?2008:parseInt(year,10);
      var _month=(month==null)?1:parseInt(month,10);
      var _day=(day==null)?1:parseInt(day,10);
      
      var _lastMonth = _month-1;
      var _lastYear  = _year-1;
      var _nextMonth = _month+1;
      var _nextyear  = _year+1;
      
      var fw=GetFirstWeek(_year,_month);
      var ld=GetLastDays(_year,_month);
      var td=GetThisDays(_year,_month);
    
      var isnd=false;
      var d=1;

      var aWeek=[];
      var aWeekFlag=[];
      var allDay = [];
      var allDayFlag = [];
      var tf = (fw==0)?fw+7:fw;     //如第一天是星期天.+7.保证可以看到上个月的日期
    
      //----------------------------------------------------------------
      //第一行上月日期+第一行本月日期
      //----------------------------------------------------------------
      for (l=(ld-tf+1);l<=ld;l++)  {
        var tmpDate = (_lastMonth==0)?""+_lastYear+"-12-"+FullNumber(l):_year+"-"+FullNumber(_lastMonth)+"-"+FullNumber(l);
        aWeek.push(tmpDate);
        aWeekFlag.push(0);
      }
      
      for (f=tf;f<=6;f++) {
        aWeek.push(_year+"-"+FullNumber(_month)+"-"+FullNumber(d));
        aWeekFlag.push(1);
        d++;
      }
      allDay.push(aWeek);
      allDayFlag.push(aWeekFlag);
    
      //----------------------------------------------------------------
      //其他行本月日期
      //----------------------------------------------------------------
      for (i=2;i<7;i++){
        aWeek = [];
        aWeekFlag = [];
        
        for (j=1;j<8;j++){
          if (isnd){                            //下个月的日期
            var tmpDate = (_nextMonth==13)?""+_nextyear+"-01-"+FullNumber(d):_year+"-"+FullNumber(_nextMonth)+"-"+FullNumber(d);
            aWeek.push(tmpDate);
            aWeekFlag.push(0);
          }else{                                //本月的日期
            aWeek.push(_year+"-"+FullNumber(_month)+"-"+FullNumber(d));
            aWeekFlag.push(1);
          }
          
          if (d==td){       //判断是否为本月的日期
            isnd=true;
            d=0;
          }
          d++;
        }
        allDay.push(aWeek);
        allDayFlag.push(aWeekFlag);
      }
      //debugger;
      alert(allDay.join("\n")+"\n\n"+allDayFlag.join("\n"));
      return {dateList:allDay,dataFlag:allDayFlag};
    }
//==========================================================================================================================
//==========================================================================================================================



Sail = {};

Sail.apply = function(o, c, defaults){
    if(defaults){
        // no "this" reference for friendly out of scope calls
        Sail.apply(o, defaults);
    }
    if(o && c && typeof c == 'object'){
        for(var p in c){
            o[p] = c[p];
        }
    }
    return o;
};


(function(){
    Sail.apply(Sail, {

        /** *********************
        * 维护命名空间
        * @param {string} 命名空间串
        * @return {}
        */
        namespace : function() {
            var a=arguments, o=null, i, j, d, rt;
            for (i=0; i<a.length; ++i) {
                d=a[i].split(".");
                rt = d[0];
                eval('if (typeof ' + rt + ' == "undefined"){' + rt + ' = {};} o = ' + rt + ';');
                for (j=1; j<d.length; ++j) {
                    o[d[j]]=o[d[j]] || {};
                    o=o[d[j]];
                }
            }
        },
        
        /**
         * Extends one class with another class and optionally overrides members with the passed literal. This class
         * also adds the function "override()" to the class that can be used to override
         * members on an instance.
         * @param {Object} subclass The class inheriting the functionality
         * @param {Object} superclass The class being extended
         * @param {Object} overrides (optional) A literal with members
         * @method extend
         */
        extend : function(){
            // inline overrides
            var io = function(o){
                for(var m in o){
                    this[m] = o[m];
                }
            };
            return function(sb, sp, overrides){
                
                if(typeof sp == 'object'){
                    overrides = sp;
                    sp = sb;
                    sb = function(){sp.apply(this, arguments);};
                }
                var F = function(){}, sbp, spp = sp.prototype;
                F.prototype = spp;
                sbp = sb.prototype = new F();
                sbp.constructor=sb;
                sb.superclass=spp;
                if(spp.constructor == Object.prototype.constructor){
                    spp.constructor=sp;
                }
                //alert();
                sb.override = function(o){
                    Sail.override(sb, o);
                };
                sbp.override = io;
                //debugger;
                Sail.override(sb, overrides);
                return sb;
            };
        }(),
        
        /*
         * @param {Object} origclass The class to override
         * @param {Object} overrides The list of functions to add to origClass.  This should be specified as an object literal
         * containing one or more methods.
         * @method override
         */
        override : function(origclass, overrides){
            if(overrides){
                var p = origclass.prototype;
                for(var method in overrides){
                    p[method] = overrides[method];
                }
            }
        },
                
        /** *********************
        * 根据ID取得对象
        * @param {string} ID
        * @return {object} 对象
        */
        $: function(_objid) {
            return document.getElementById(_objid);
        },
        get: function(_objid) {
            return document.getElementById(_objid);
        },
        /** *********************
        * 根据ID取得对象
        * @param {string} ID
        * @return {object} 对象
        */
        createDIV : function(father,config){
            var tmpDiv = document.createElement( "DIV" );  
            this.apply(tmpDiv.style,config);        
            
            tmpDiv.className    = "div-container";
            tmpDiv.id           = tmpDiv.uniqueID;              
            father.appendChild(tmpDiv);                   //添加到窗口
            return tmpDiv;
        },
        
        /*
        * 根据ID取得对象
        * @param {string} ID
        * @return {object} 对象
        */
        setOptions : function(selectobj,optionArray){
            for(var i=0;i<optionArray.length;i++) {
                selectobj.options[selectobj.length] = new Option();
                Sail.apply(selectobj.options[selectobj.length-1],optionArray[i]);
            }
        },
        boxTo5w : function(value){
            return Sail.formatNumber2(value*5,2);
        },  
        formatNumber2 : function(value,digit){
            //var _digit = (digit==undefined)?2:digit;
            if(value==0 || value==undefined || value=="" || value==null) return "";
            var _digit=2;
            
            var _tmp = Math.pow(10,_digit);
            var _tmpValue = ""+Math.round(value*_tmp)/_tmp;
            
            var nums = _tmpValue.split(".");
            
            if(nums.length==1) 
                return _tmpValue+".00";
            else{
                if(nums[1].length==1) return _tmpValue+"0";
                else return _tmpValue;
            }
        },
        formatPercent : function(value){
        	//return Math.round(value*10000)/100+"%";
        	return value+"%";
        },
        
        formatDate : function(v){
          if (v == undefined) v = "";
          return v.substr(0,4)+"-"+v.substr(4,2)+"-"+v.substr(6,2);
        },
        
        write : function(info){
            //this.get("debugvalue3").value = info;
        },
        
        getMaxNumber: function(numberArray) {
            return eval("Math.max("+numberArray.join(',')+")");
        },
        
        getSum : function(numberArray) {
            var returnValue = 0;
            for(var i=0;i<numberArray.length;i++)
                returnValue+=numberArray[i];
            return returnValue;
        },
        
        getMinNumber: function(numberArray) {
            return eval("Math.min("+numberArray.join(',')+")");
        },

        /** *********************
        * 取得对象绝对的左位置坐标
        * @param {object} 对象
        * @return {int} 作位置
        */
        setStyle2Obj: function(_obj,_config) {
            for(var p in _config){
                if(typeof _config[p]=="function")
                    _obj[p] = _config[p];
                else
                {
                    if(p=="id" || p=="innerHTML")
                        _obj[p] = _config[p];
                    else
                        _obj.style[p] = _config[p];
                }
            }
        },

        /** *********************
        * 取得对象绝对的左位置坐标
        * @param {object} 对象
        * @return {int} 作位置
        */
        getX: function(o) {
            var l=o.offsetLeft;
            while(o=o.offsetParent){
                l+=o.offsetLeft;
            }
            return l;
        },
        
        /** *********************
        * 取得对象绝对的上位置坐标
        * @param {object} 对象
        * @return {int} 上位置
        */
        getY: function(o) {
            var t=o.offsetTop;
            while(o=o.offsetParent){
                t+=o.offsetTop;
            }
            return t;
        }
        
    });


})();



Sail.namespace("Sail", 'Sail.data',"Sail.main","Sail.iDesign","Sail.dd","Sail.widgets","Sail.public","Sail.hLine","Sail.vLine","Sail.rect","Sail.htmlFile","Sail.stringBuffer","Sail.debug");



function extract_left(total_chars) {
    return this.substring(0, total_chars);
}

function replace_string(find_string, replace_string) {

    var temp_string = this;
    var left_string;
    var right_string;
    var start_location;

    var replace_location = temp_string.indexOf(find_string);
    while (replace_location != -1) {
        left_string = temp_string.left(replace_location);
        right_string = temp_string.substring(replace_location + find_string.length);
        temp_string = left_string + replace_string + right_string;
        start_location = replace_location + replace_string.length;
        replace_location = temp_string.indexOf(find_string, start_location);
    }
    return temp_string;
}
String.prototype.left = extract_left;
String.prototype.replaceAll = replace_string;


//==========================================================================================================================
//==========================================================================================================================
//==========================================================================================================================
//==========================================================================================================================
Sail.stringBuffer = function(len){
    this.length=0;
    
    if(arguments.length ==0) {                  //构造方法无参数，默认100空间
        this.defaultLen =100;
        this.infoArray  = new Array(100);
    }
    else  {                                     //否则，根据指定参数开辟空间    
        this.defaultLen =len;
        this.infoArray  = new Array(this.defaultLen);
    }
    
    this.toString= function () {                //转换成字符串
        return this.infoArray.join("");
    }
    
    this.push = function(_array){
        for(var i=0,len=_array.length;i<len;i++){
            this.append(_array[i]);
        }
    }
    
    this.getArray = function(){
        return this.infoArray.slice(0,this.length);
    }
    
    this.append= function (appendStr){          //追加字符串
        if(this.length<this.defaultLen){
            this.infoArray[this.length]=appendStr;
            this.length++;
        }else{
            this.infoArray[this.infoArray.length]=new String();
            this.infoArray[this.infoArray.length-1]=appendStr;
            this.length++;
        }
    }
    
    this.replaceLast = function(_info){
        this.infoArray[this.length-1] = _info;
    }
    
    this.delLast = function(){
        this.infoArray[this.length-1] = this.infoArray[this.length-1].substring(0,this.infoArray[this.length-1].length-1);
    }
    
    this.addLast = function(_char){
        this.infoArray[this.length-1] = this.infoArray[this.length-1]+_char;
    }
    
    this.clean= function () {                   //清空stringBuffer
        this.infoArray = new Array(this.defaultLen);
        this.length=0;
    }
    
    
}

Sail.point = function(x,y){
    this.x = parseInt(x,10);
    this.y = parseInt(y,10);
    
    this.isLeftTop = function(otherPoint){
        if(this.x<=otherPoint.x && this.y<=otherPoint.y)
            return this;
        else
            return otherPoint;
    }
    
}

Sail.hLine = function(left,right){
    this.left   = parseInt(left,10);
    this.right  = parseInt(right,10);
    
    this.acrossOtherLine = function(otherLine){
        if((this.left>=otherLine.left && this.left<=otherLine.right) || (this.right>=otherLine.left && this.right<=otherLine.right))
            return true;
        else
            return false;
    }
}

Sail.vLine = function(top,bottom){
    this.top   = parseInt(top,10);
    this.bottom  = parseInt(bottom,10);
    
    this.acrossOtherLine = function(otherLine){
        if((this.top>=otherLine.top && this.top<=otherLine.bottom) || (this.bottom>=otherLine.top && this.right<=otherLine.bottom))
            return true;
        else
            return false;
    }
}

Sail.rect = function(left,top,width,height){
    this.left   = parseInt(left,10);
    this.top    = parseInt(top,10);
    this.width  = parseInt(width,10);
    this.height = parseInt(height,10);
    
    this.right  = this.left + this.width;;
    this.bottom = this.top  + this.height;
    
    this.toString = function(){
        return this.right+"，"+this.bottom;
    }
    
    this.inOtherRect = function(other) {
        if(this.left>=other.left && this.top>=other.top && this.right<=other.right && this.bottom<=other.bottom)
            return true;
        else
            return false;
    }
    
    this.pointInRect = function(pointx,pointy){
        if(pointx>=this.left && pointx<=this.right && pointy>=this.top && pointy<=this.bottom)
            return true;
        else 
            return false;
    }
    
    this.acrossOtherH = function(other) {
        var lt = other.pointInRect(this.left,this.top);
        var rt = other.pointInRect(this.right,this.top);
        
        return (lt||rt)?true:false;
    }

    this.acrossOtherV = function(other) {
        var lb = other.pointInRect(this.left,this.bottom);
        var rb = other.pointInRect(this.right,this.bottom);
        
        return (lb||rb)?true:false;
    }
}



//==========================================================================================================================
//==========================================================================================================================
//==========================================================================================================================
//==========================================================================================================================
Sail.namespace("Sail.widgetForPage");

Sail.widgetForPage = function(mdiv,config){
    this.fDiv = mdiv;
    Sail.apply(this,config);
    this.init();
};
Sail.widgetForPage.prototype = {
    wpd: null,
    
    tDiv : null,
    cDiv : null,
    adjustWidth : 0,
    
    createWPD : function(){
        var pInfo   = {};
        pInfo.left  = this.left;
        pInfo.top   = this.top;
        pInfo.width = this.width;
        pInfo.height= this.height;
        
        this.wpd = Sail.createDIV(this.fDiv,pInfo);
    },
    
    init: function(){
        this.createWPD();
        
        if(this.type=="ext.input" || this.type=="ext.combox"){
            this.tDiv = Sail.createDIV(this.wpd,{left:0,top:1,height:"100%",paddingTop:3});
            this.tDiv.innerText = this.title+"：";
            var myl = this.tDiv.offsetWidth
            var myw = this.width-myl;
            this.cDiv = Sail.createDIV(this.wpd,{left:myl,top:0,height:"100%",width:myw});
            
            if(this.type=="ext.combox") this.adjustWidth = myw+3;
        }
    },
    
    toString : function(){
        return this.fDiv.id+"，"+this.left+"，"+this.top;
    }
};



//==========================================================================================================================
//==========================================================================================================================
//==========================================================================================================================
//==========================================================================================================================
if(!Array.prototype.map){
    Array.prototype.map = function(fun){
    	var len = this.length;
    	if(typeof fun != "function"){
    	    throw new TypeError();
    	}
    	var res = new Array(len);
    	var thisp = arguments[1];
    	for(var i = 0; i < len; i++){
    	    if(i in this){
    		res[i] = fun.call(thisp, this[i], i, this);
    	    }
    	}
        return res;
    };
}

if(!Array.prototype.insertItems){
    Array.prototype.insertItems = function(after,items){
        var len = this.length;
        
        var subArray1 = this.slice(0,after+1);
        var subArray2 = this.slice(after+1);
        var newArray = [].concat(subArray1,items,subArray2);
        subArray1 = null;
        subArray2 = null;
        return newArray; 
    }
}


Ext.data.PagingMemoryProxy = function(data, config) {
	Ext.data.PagingMemoryProxy.superclass.constructor.call(this);
	this.data = data;
	Ext.apply(this, config);
};

Ext.extend(Ext.data.PagingMemoryProxy, Ext.data.MemoryProxy, {
	customFilter: null,
	
	load : function(params, reader, callback, scope, arg) {
		params = params || {};
		var result;
		try {
			result = reader.readRecords(this.data);
		} catch(e) {
			this.fireEvent("loadexception", this, arg, null, e);
			callback.call(scope, null, arg, false);
			return;
		}
		
		if (this.customFilter!=null) {
			result.records = result.records.filter(this.customFilter);
			result.totalRecords = result.records.length;
		} else if (params.filter!==undefined) {
			result.records = result.records.filter(function(el){
			    if (typeof(el)=="object"){
					var att = params.filterCol || 0;
					return String(el.data[att]).match(params.filter)?true:false;
			    } else {
					return String(el).match(params.filter)?true:false;
			    }
			});
			result.totalRecords = result.records.length;
		}
		
		if (params.sort!==undefined) {
		    var dir = String(params.dir).toUpperCase() == "DESC" ? -1 : 1;
        	    var fn = function(r1, r2){
			    return r1==r2 ? 0 : r1<r2 ? -1 : 1;
        	    };
		    var st = reader.recordType.getField(params.sort).sortType;
		    result.records.sort(function(a, b) {
				var v = 0;
				if (typeof(a)=="object"){
				    v = fn(st(a.data[params.sort]), st(b.data[params.sort])) * dir;
				} else {
				    v = fn(a, b) * dir;
				}
				if (v==0) {
				    v = (a.index < b.index ? -1 : 1);
				}
				return v;
		    });
		}

		if (params.start!==undefined && params.limit!==undefined) {
			result.records = result.records.slice(params.start, params.start+params.limit);
		}
		
		callback.call(scope, result, arg, true);
	}
});



//--------------------------------------------------------------------------------
//JSON 
//--------------------------------------------------------------------------------
if (!Object.prototype.toJSONString) {
    Array.prototype.toJSONString = function (w) {
        var a = [],i,l = this.length,v;

        for (i = 0; i < l; i += 1) {
            v = this[i];
            switch (typeof v) {
            case 'object':
                if (v && typeof v.toJSONString === 'function') {
                    a.push(v.toJSONString(w));
                } else {
                    a.push('null');
                }
                break;
            case 'string':
            case 'number':
            case 'boolean':
                a.push(v.toJSONString());
                break;
            default:
                a.push('null');
            }
        }
        return '[' + a.join(',') + ']';
    };

    Boolean.prototype.toJSONString = function () {
        return String(this);
    };

    Date.prototype.toJSONString = function () {
        function f(n) {
            return n < 10 ? '0' + n : n;
        }
        return '"' + this.getUTCFullYear()   + '-' +
                   f(this.getUTCMonth() + 1) + '-' +
                   f(this.getUTCDate())      + 'T' +
                   f(this.getUTCHours())     + ':' +
                   f(this.getUTCMinutes())   + ':' +
                   f(this.getUTCSeconds())   + 'Z"';
    };


    Number.prototype.toJSONString = function () {
        return isFinite(this) ? String(this) : 'null';
    };


    Object.prototype.toJSONString = function (w) {
        var a = [],k,i,v;

        if (w) {
            for (i = 0; i < w.length; i += 1) {
                k = w[i];
                if (typeof k === 'string') {
                    v = this[k];
                    switch (typeof v) {
                    case 'object':
                        if (v) {
                            if (typeof v.toJSONString === 'function') {
                                a.push(k.toJSONString() + ':' +
                                       v.toJSONString(w));
                            }
                        } else {
                            a.push(k.toJSONString() + ':null');
                        }
                        break;

                    case 'string':
                    case 'number':
                    case 'boolean':
                        a.push(k.toJSONString() + ':' + v.toJSONString());
                    }
                }
            }
        } else {
            for (k in this) {
                if (typeof k === 'string' &&
                        Object.prototype.hasOwnProperty.apply(this, [k])) {
                    v = this[k];
                    switch (typeof v) {
                    case 'object':
                        if (v) {
                            if (typeof v.toJSONString === 'function') {
                                a.push(k.toJSONString() + ':' +
                                       v.toJSONString());
                            }
                        } else {
                            a.push(k.toJSONString() + ':null');
                        }
                        break;

                    case 'string':
                    case 'number':
                    case 'boolean':
                        a.push(k.toJSONString() + ':' + v.toJSONString());
                    }
                }
            }
        }
        return '{' + a.join(',') + '}';
    };


    (function (s) {
        var m = {'\b': '\\b','\t': '\\t','\n': '\\n','\f': '\\f','\r': '\\r','"' : '\\"','\\': '\\\\'};
        s.parseJSON = function (filter) {
            var j;

            function walk(k, v) {
                var i, n;
                if (v && typeof v === 'object') {
                    for (i in v) {
                        if (Object.prototype.hasOwnProperty.apply(v, [i])) {
                            n = walk(i, v[i]);
                            if (n !== undefined) {
                                v[i] = n;
                            } else {
                                delete v[i];
                            }
                        }
                    }
                }
                return filter(k, v);
            }
            if (/^[\],:{}\s]*$/.test(this.replace(/\\./g, '@').
                    replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
                    replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
                j = eval('(' + this + ')');
                return typeof filter === 'function' ? walk('', j) : j;
            }
            throw new SyntaxError('parseJSON');
        };

        s.toJSONString = function () {
            if (/["\\\x00-\x1f]/.test(this)) {
                return '"' + this.replace(/[\x00-\x1f\\"]/g, function (a) {
                    var c = m[a];
                    if (c) {
                        return c;
                    }
                    c = a.charCodeAt();
                    return '\\u00' + Math.floor(c / 16).toString(16) +
                                               (c % 16).toString(16);
                }) + '"';
            }
            return '"' + this + '"';
        };
    })(String.prototype);
}

function yjjtestFn(a,b,c){
    var returnObj =window.showModalDialog("aaaa",null,'dialogWidth:400px;dialogHeight:300px;center:1;scroll:1;help:0;status:0');
    return {id:a,text:b,last:c};
}



//====================================================================================================
//扩展pageBar
//====================================================================================================
/*
Ext.override(Ext.PagingToolbar,{
    onRender : function(ct, position){
        Ext.PagingToolbar.superclass.onRender.call(this, ct, position);
        
        //----------------------------------------------------------------
        //20080820 160400 于俊杰扩展
        //增加设置每页记录数的输入框及其回车响应
        //----------------------------------------------------------------
        this.addSeparator();
        this.add('每页');
        this.sizeField = Ext.get(this.addDom({
           tag: "input",
           type: "text",
           size: "3",
           value: this.pageSize,
           cls: "x-tbar-page-number"
        }).el);
        this.add('条');
        this.addSeparator();
        this.sizeField.on("keydown", this.onPageSizeKeydown, this);
        this.sizeField.on("focus", function(){this.dom.select();});
        this.sizeField.setHeight(18);
        //----------------------------------------------------------------
        //扩展结束
        //----------------------------------------------------------------
        
        this.first = this.addButton({
            tooltip: this.firstText,
            iconCls: "x-tbar-page-first",
            disabled: true,
            handler: this.onClick.createDelegate(this, ["first"])
        });
        this.prev = this.addButton({
            tooltip: this.prevText,
            iconCls: "x-tbar-page-prev",
            disabled: true,
            handler: this.onClick.createDelegate(this, ["prev"])
        });
        this.addSeparator();
        this.add(this.beforePageText);
        this.field = Ext.get(this.addDom({
           tag: "input",
           type: "text",
           size: "3",
           value: "1",
           cls: "x-tbar-page-number"
        }).el);
        this.field.on("keydown", this.onPagingKeydown, this);
        this.field.on("focus", function(){this.dom.select();});
        this.afterTextEl = this.addText(String.format(this.afterPageText, 1));
        this.field.setHeight(18);
        this.addSeparator();
        this.next = this.addButton({
            tooltip: this.nextText,
            iconCls: "x-tbar-page-next",
            disabled: true,
            handler: this.onClick.createDelegate(this, ["next"])
        });
        this.last = this.addButton({
            tooltip: this.lastText,
            iconCls: "x-tbar-page-last",
            disabled: true,
            handler: this.onClick.createDelegate(this, ["last"])
        });
        this.addSeparator();
        this.loading = this.addButton({
            tooltip: this.refreshText,
            iconCls: "x-tbar-loading",
            handler: this.onClick.createDelegate(this, ["refresh"])
        });

        if(this.displayInfo){
            this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});
        }
        if(this.dsLoaded){
            this.onLoad.apply(this, this.dsLoaded);
        }
    },

    readPageSize : function(){
        var v = this.sizeField.dom.value, pageSize;
        if (!v || isNaN(pageSize = parseInt(v, 10))) {
            this.sizeField.dom.value = this.pageSize;
            return false;
        }
        return pageSize;
    },
    
    onPageSizeKeydown : function(e){
        var k = e.getKey(), d = this.getPageData(), pageNum;
        if (k == e.RETURN) {
            e.stopEvent();
            if(pageSize = this.readPageSize()){
                this.pageSize = pageSize;
            }
            if(pageNum = this.readPage(d)){
                pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
                this.doLoad(pageNum * this.pageSize);
            }
        }
    }
});
*/

//====================================================================================================
//====================================================================================================
Ext.grid.RowNumberer = function(config){
    Ext.apply(this, config);
    if(this.rowspan){
        this.renderer = this.renderer.createDelegate(this);
    }
};

Ext.grid.RowNumberer.prototype = {
    header: "",
    width: 23,
    sortable: false,

    fixed:true,
    dataIndex: '',
    id: 'numberer',
    rowspan: undefined,

    renderer : function(v, p, record, rowIndex){
        if(this.rowspan){
            p.cellAttr = 'rowspan="'+this.rowspan+'"';
        }
        return rowIndex+1;
    }
};

//====================================================================================================
//表头列合并、行合并
//====================================================================================================
Ext.namespace("Ext.ux.plugins");
Ext.ux.plugins.XGrid = function(config) {
	Ext.apply(this, config);
};
Ext.extend(Ext.ux.plugins.XGrid, Ext.util.Observable, {
    init: function(grid){
		this.grid = grid;
		this.view = this.grid.getView();
        this.view.layout = this.layout.createDelegate(this);
        this.grid.render = this.render.createDelegate(this);
        var cm = this.grid.getColumnModel();
        if(cm.headers) {
            this.initTemplates();
            this.initMethodDelegate();
            this.grid.on("columnresize", this.onColumnresize, this);
        }
 	},
    render : function(container, position){
        if(!this.grid.rendered && this.grid.fireEvent("beforerender", this) !== false){
            if((!container && this.grid.el) || typeof container == "string"){
                var elId = container ? container : this.grid.el;
                var c = document.getElementById(elId);
                if (!c.style.height) {
                    c.style.height = '100%';
                }
                this.grid.originWidth = c.offsetWidth;
                this.grid.originHeight = c.offsetHeight;
                this.grid.el = Ext.get(elId);
                container = this.grid.el.dom.parentNode;
                this.grid.allowDomMove = false;
            }
            this.grid.container = Ext.get(container);
            if(this.grid.ctCls){
                this.grid.container.addClass(this.grid.ctCls);
            }
            this.grid.rendered = true;
            if(position !== undefined){
                if(typeof position == 'number'){
                    position = this.grid.container.dom.childNodes[position];
                }else{
                    position = Ext.getDom(position);
                }
            }
            this.grid.onRender(this.grid.container, position || null);
            if(this.grid.autoShow){
                this.grid.el.removeClass(['x-hidden','x-hide-' + this.grid.hideMode]);
            }
            if(this.grid.cls){
                this.grid.el.addClass(this.grid.cls);
                delete this.grid.cls;
            }
            if(this.grid.style){
                this.grid.el.applyStyles(this.grid.style);
                delete this.grid.style;
            }
            this.grid.fireEvent("render", this);
            this.grid.afterRender(this.grid.container);
            if(this.grid.hidden){
                this.grid.hide();
            }
            if(this.grid.disabled){
                this.grid.disable();
            }

            this.grid.initStateEvents();
        }
        return this;
    },

    layout : function(){
        if(!this.view.mainBody){
            return; // not rendered
        }
        var g = this.view.grid;
        var c = g.getGridEl(), cm = this.view.cm,
                expandCol = g.autoExpandColumn,
                gv = this;
        if( Ext.isIE) {
            c.setHeight(this.grid.originHeight);
        }
        var csize = c.getSize(true);
        var vw = csize.width;

        if(vw < 20 || csize.height < 20){ // display: none?
            return;
        }

        if(g.autoHeight){
            this.view.scroller.dom.style.overflow = 'visible';
        }else{
            if( Ext.isIE) {
                this.view.el.setSize('100%', csize.height);
    
                var hdHeight = this.view.mainHd.getHeight();
                var vh = csize.height - (hdHeight);

    
                this.view.scroller.setSize('100%', vh);
                if(this.view.innerHd){
                    this.view.innerHd.style.width = '100%';
                }
            }    
            else {
                this.view.el.setSize(csize.width, csize.height);
    
                var hdHeight = this.view.mainHd.getHeight();
                var vh = csize.height - (hdHeight);
    
                this.view.scroller.setSize(vw, vh);
                if(this.view.innerHd){
                    this.view.innerHd.style.width = (vw)+'px';
                }
            }
        }
        if(this.view.forceFit){
            if(this.view.lastViewWidth != vw){
                this.view.fitColumns(false, false);
                this.view.lastViewWidth = vw;
            }
        }else {
            this.view.autoExpand();
        }
        this.view.onLayout(vw, vh);
    },
    initTemplates: function(){
        this.view.initTemplates.call(this);
        this.view.templates = {
            header : new Ext.Template(
                    '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle};TABLE-LAYOUT: auto">',
                    '<thead>',
                    '{headers}',
                    '</thead>',
                    "</table>"
                    ),
            hcell : new Ext.Template(
                    '<td ',
                    '{rowspan}',
                    ' {colspan} ',
                    'class="x-grid3-hd x-grid3-cell x-grid3-td-{id}" ',
                    'style="{style}"><div {tooltip} {attr} ',
                    'class="x-grid3-hd-inner x-grid3-hd-{id}" ',
                    'unselectable="on" style="{istyle}">', 
                    this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
                    '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
                    "</div></td>"
                    ),
            ghcell : new Ext.Template(
                    '<td ',
                    '{rowspan}',
                    ' {colspan} ',
                    'class="x-grid3-hd" ',
                    'style="border-bottom:1px solid #D0D0D0;{style}"><div {tooltip} {attr} ',
                    'class="x-grid3-hd-inner" ',
                    'unselectable="on" style="{istyle}">', 
                    this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
                    '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
                    "</div></td>"
                    )

        };
    },
    
    initMethodDelegate: function() {
        var view = this.grid.getView();
        view.renderHeaders = this.renderHeaders.createDelegate(this);
        view.getColumnStyle = this.getColumnStyle.createDelegate(this);
        view.getHeaderCell = this.getHeaderCell.createDelegate(this);
        view.updateSortIcon = this.updateSortIcon.createDelegate(this);
        var cm = this.grid.getColumnModel();
        cm.moveColumn = this.moveColumn.createDelegate(this);
        /*
        view.getColumnWidth = this.getColumnWidth.createDelegate(this);
        view.getTotalWidth = this.getTotalWidth.createDelegate(this);
        */
    },

    moveColumn : function(oldIndex, newIndex){
        var cm = this.grid.getColumnModel();
        var c = cm.config[oldIndex];
        if (this.realCM) {
            var rm1 = this.realCM[oldIndex];
            var rm2 = this.realCM[newIndex];
            if ( (!rm1.rowspan && !rm2.rowspan) || (rm1.rowspan == rm2.rowspan)) {
                cm.config.splice(oldIndex, 1);
                cm.config.splice(newIndex, 0, c);
                cm.dataMap = null;
                this.columnMoved = true;
                cm.fireEvent("columnmoved", cm, oldIndex, newIndex);
                this.columnMoved = false;
            }
        } else {
            cm.config.splice(oldIndex, 1);
            cm.config.splice(newIndex, 0, c);
            cm.dataMap = null;
            this.columnMoved = true;
            cm.fireEvent("columnmoved", cm, oldIndex, newIndex);
            this.columnMoved = false;
        }
    },
    
    renderHeaders : function(){
        var cm = this.grid.getColumnModel();
        var hm = cm.headers;
        var ts = this.view.templates;
        var ct = ts.hcell;
        var tHeaderRow = new Ext.Template(
            '<tr class="x-grid3-hd-row">{cells}</tr>'
        );
        this.realCM = this.processRealColumnModel();
        /*
        for(var i = 0, len = this.realCM.length; i < len; i++){
            var config = cm.config[i];
            rm = this.realCM[i];
            //rm.style = this.getColumnStyle(i, true, rm);
            //rm.id = config ? config.id : rm.id;
            if (config) {
                rm.header = config.header;
            }
        }
        */
        //debugger;
        var  rs = [];
        
        var colIndex = 0;
        for(var k = 0; k < hm.length; k++) {
            var header = hm[k];
            var cb = [];
            for(var i = 0, len = header.length; i < len; i++){
                var p = {};
                var rm = header[i];
                p.id = rm.id ? rm.id : i;
                p.value = rm.header || "";
                //p.value = this.findHeaderFromConfig(rm.id, rm.header) || "";
                if(p.value==""&&i==0)
                    p.style ="width:22px;text-align:center;";
                else
                    p.style = rm.style || ""; // this.view.getColumnStyle(i, true, rm);
                //p.style = rm.style || ;
                p.tooltip = cm.getColumnTooltip(i);
                if (rm.rowspan) {
                    p.rowspan = 'rowspan=' + rm.rowspan;
                }
                if (rm.colspan && rm.colspan > 1) {
                    var colspan = rm.colspan;
                    var w = 0;
                    for (var c = 0; c < colspan; c++) {
                        var subCM = cm.config[colIndex+c];
                        if (subCM) {
                            w += cm.getColumnWidth(colIndex+c);
                        }
                    }
                    var style = '';
                    style += 'width:'+w+'px;';
                    if(cm.isHidden(i)){
                        style += 'display:none;';
                    }
                    var align = rm.align;
                    if(align){
                        style += 'text-align:'+align+';';
                    } else {
                        style += 'text-align:center;';
                    }
                    p.style = style;
                    p.colspan = 'colspan=' + rm.colspan;
                }
                
                if (rm.align == 'right'){
                    //p.istyle = 'padding-right:16px';
                } else {
                    delete p.istyle;
                }
                if (typeof(rm.id) != typeof(undef)) {
                    cb[cb.length] = ct.apply(p);
                    colIndex++ ;
                } else {
                    cb[cb.length] = ts.ghcell.apply(p);
                }
            }
            rs[rs.length] = tHeaderRow.apply({cells: cb.join("")});
        }

        //var data = ts.header.apply({headers:rs.join("")});
        var data = ts.header.apply({headers:rs.join(""), tstyle:'width:'+this.view.getTotalWidth()+';'});
        
        //document.getElementById("testdata").value=data;
        return data;
    },
    
    processRealColumnModel : function() {
        var cm = this.grid.getColumnModel();
        if (!cm.headers) {
            return cm.config;
        }
        var hm = cm.headers;
        var rows = hm.length;
        var realModels = [];
        var tmp = [];
        for (var i = 0; i < rows; i++) {
            tmp.push([]);
        }
        for (var k = 0; k < rows; k++) {
            var header = hm[k];
            for(var i = 0, len = header.length; i < len; i++){
                var p = header[i];
                
                var position = this.pushInto(tmp[k], p);
                
                if (p.rowspan && p.rowspan > 0) {
                    for (var r = 1; r < p.rowspan; r++) {
                        tmp[k + r][position] = p;
                    }
                }
                
                if (p.colspan && p.colspan > 0) {
                    for (var c = 0; c < p.colspan - 1; c++) {
                        position = this.pushInto(tmp[k], p);
                        if (p.rowspan && p.rowspan > 0) {
                            for (var r = 1; r < p.rowspan; r++) {
                                tmp[k + r][position] = p;
                            }
                        }
                    }
                }
            }
        }
        
        for (var i = 0; i < tmp[tmp.length-1].length; i++) {
            realModels.push(tmp[tmp.length-1][i]);
        }

        delete tmp;
        
        for(var i = 0, len = realModels.length; i < len; i++){
            var config = cm.config[i];
            rm = realModels[i];
            rm.style = this.getColumnStyle(i, true, rm);
            rm.id = config ? config.id : rm.id;
            if (config) {
                if (this.columnMoved) {
                    rm.header = config.header;
                } else {
                    config.header = rm.header;
                }

            }
        }
        return realModels;
    },
    
    pushInto : function(arrayObj, obj) {
        for (var i = 0; i < arrayObj.length; i++) {
            if (!arrayObj[i]) {
                arrayObj[i] = obj;
                return i;
            }
        }
        arrayObj.push(obj);
        return arrayObj.length - 1;
    },

    getColumnStyle : function(col, isHeader, realModel){
        var cm = this.grid.getColumnModel();
        var view = this.grid.getView();
        var style = !isHeader ? (cm.config[col].css || '') : '';
        if (Ext.isIE) {
            var w = cm.getColumnWidth(col);
            //w = isHeader ? w : w + 2;
            style += 'width:'+w+'px;';
        } else {
            style += 'width:'+this.view.getColumnWidth(col)+';';
        }
        if(cm.isHidden(col)){
            style += 'display:none;';
        }
        var align = cm.config[col].align;
        if (realModel && realModel.align) {
            align = realModel.align;
        }
        if (align) {
            style += 'text-align:'+align+';';
        } else {
            style += 'text-align:center;';
        }
        return style;
    },
    
    getHeaderCell : function(index){
        var view = this.grid.getView();
        var hds = view.mainHd.select('.x-grid3-cell');
        return (hds.item(index).dom);
    },
    
    updateSortIcon : function(col, dir){
        var sc = this.view.sortClasses;
        var hds = this.view.mainHd.select('.x-grid3-cell').removeClass(sc);
        hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
    },

    onColumnresize : function(col, width){
        var cm = this.grid.getColumnModel();
        this.grid.reconfigure(this.grid.store,cm);
    }
});

//====================================================================================================
//时间录入组件
//====================================================================================================
Ext.form.timeInput = Ext.extend(Ext.form.TextField,  {
    fieldClass: "x-form-field x-form-num-field",
    allowDecimals : true,
    decimalSeparator : ".",
    decimalPrecision : 0,
    allowNegative : true,
    maxLength : 5,
    minValue : Number.NEGATIVE_INFINITY,
    maxValue : Number.MAX_VALUE,
    minText : "The minimum value for this field is {0}",
    maxText : "The maximum value for this field is {0}",
    nanText : "{0} is not a valid number",
    baseChars : "0123456789:",

    initEvents : function(){
        Ext.form.NumberField.superclass.initEvents.call(this);
        var allowed = this.baseChars+'';

        this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
        var keyPress = function(e){
            var k = e.getKey();
            if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){
                return;
            }
            var c = e.getCharCode();
            if(allowed.indexOf(String.fromCharCode(c)) === -1){
                e.stopEvent();
            }
        };
        this.el.on("keypress", keyPress, this);
        this.el.dom.maxLength = this.maxLength;
    },

    validateValue : function(value){
        if(!Ext.form.timeInput.superclass.validateValue.call(this, value)){
            return false;
        }
        if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
             return true;
        }
        return true;
    },

    getValue : function(){
        return this.parseValue(Ext.form.timeInput.superclass.getValue.call(this));
    },

    setValue : function(v){
        Ext.form.timeInput.superclass.setValue.call(this, v);
    },

    // private
    parseValue : function(value){
        var infos = value.split(':');
        if(infos.length!=2) return '';
        
        if(parseInt(infos[0],10)>23) return '';
        if(parseInt(infos[1],10)>59) return '';
        
        return value;
    },

    beforeBlur : function(){
        var v = this.parseValue(this.getRawValue());
        if(v){
            this.setValue(v);
        }
    }
});
Ext.reg('timeinput', Ext.form.timeInput);


Ext.override(Ext.form.Field,{
    onFocus : function(){
        //debugger;    
        if(!Ext.isOpera && this.focusClass){ // don't touch in Opera
            this.el.addClass(this.focusClass);
        }
        if(!this.hasFocus){
            this.hasFocus = true;
            this.startValue = this.getValue();
            this.fireEvent("focus", this);
        }
    },
    onBlur : function(){
        //debugger;
        this.beforeBlur();
        if(!Ext.isOpera && this.focusClass){             this.el.removeClass(this.focusClass);
        }
        this.hasFocus = false;
        if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){
            this.validate();
        }
        var v = this.getValue();
        if(String(v) !== String(this.startValue)){
            this.fireEvent('change', this, v, this.startValue);
        }
        this.fireEvent("blur", this);
    }
});

//====================================================================================================
//====================================================================================================
Ext.form.SelectField = Ext.extend(Ext.form.TriggerField,  {
    
    readOnly : false,
    minValue : null,
    maxValue : null,
    invalidText : "{0} is not a valid date - it must be in the format {1}",
    triggerClass : 'x-form-select-trigger',
    defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"},
    showValue : "",
    
    openUrl : "",
    dataObj : {},

    onHide : function(){
        //debugger;
        this.wrap.dom.style.display = 'none';
    },
    
    initComponent : function(){
        //debugger;
        Ext.form.SelectField.superclass.initComponent.call(this);

        this.addEvents("beforeclick");
        this.addEvents("datachange");
        this.addEvents("afterclick");
        
    },

    initEvents : function(){    
        this.el.on("keypress", this.myKeyFn,  this);
        this.el.on("focus", this.onFocus,  this);
        //20080812威威发现加次定义后，点击...按钮不会弹出窗口啦
        //原因分析结果是：加了blur事件后，导致真个组件失去焦点，因此无法响应...按钮的点击事件
        //this.el.on("blur", this.triggerBlur,  this);      
        
        
    },
    
    myKeyFn : function(e){
        var k = e.getKey();
        if(!Ext.isIE && (e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1))){
            return;
        }
        
        if(k==e.ENTER){
            this.inputText = this.el.dom.value;
            this.keyFireEvent = true;
            this.onTriggerClick();
        }
    },
    // private
    validateValue : function(value){
        if(!Ext.form.SelectField.superclass.validateValue.call(this, value)){
            return false;
        }
        return true;
    },

    validateBlur : function(){
        return !this.menu || !this.menu.isVisible();
    },

    getValue : function(){
        //return this.getDataObj((this.value)?this.value:"id");
        
        return Ext.form.SelectField.superclass.getValue.call(this) || "";
    },

    getText : function(){
        return this.getDataObj((this.text)?this.text:"text");    
    },
    setValue : function(date){
        Ext.form.SelectField.superclass.setValue.call(this, date);
        if(date=="") this.clearDataObj();
        var flag = this.fireEvent("datachange", this,this);

        //var flag = this.fireEvent("afterclick", this,this,this.dataObj);
    },

    // private
    onDestroy : function(){
        if(this.wrap){
            this.wrap.remove();
        }
        Ext.form.SelectField.superclass.onDestroy.call(this);
    },

    onTriggerClick : function(){
        if(this.disabled){
            return;
        }
        var flag = this.fireEvent("beforeclick", this,this);
        
        if(!flag) {
            this.keyFireEvent = false;
            return;
        }
        
        this.onFocus();
        if(!this.openUrl || this.openUrl=="") {
            if(this.openFn && this.openFn!=""){
                eval("var returnObj = "+this.openFn);
                //debugger;
                if(returnObj){
                    this.dataObj = {};
                    Ext.apply(this.dataObj,returnObj);
                    this.setValue((returnObj[this.showValue])?returnObj[this.showValue]:"");
                    var flag = this.fireEvent("afterclick", this,this);
                }
            }
            else{
                var flag = this.fireEvent("afterclick", this,this);
                this.keyFireEvent = false;
                return;
            }
            
        }else{
            var sData = {inputText:this.inputText};
            var w=(this.openWidth)?this.openWidth:400;
            var h=(this.openHeight)?this.openHeight:300;
            
            var returnObj =window.showModalDialog(this.openUrl,sData,'dialogWidth:'+w+'px;dialogHeight:'+h+'px;center:1;scroll:1;help:0;status:0');
    
            if(returnObj){
                this.dataObj = {};
                Ext.apply(this.dataObj,returnObj);

                this.setValue((returnObj[this.showValue])?returnObj[this.showValue]:"");
                
                if(this.advanced){
                    this.setAdvanced(returnObj[this.dataValue]?returnObj[this.dataValue]:'');
                }
                var flag = this.fireEvent("afterclick", this,this);
            }
        }
        this.keyFireEvent = false;
    },
    setDataObj : function(d){
        this.dataObj = {};
        Ext.apply(this.dataObj,d);
    },
    getDataObj : function(){
        var a = arguments;
        return (a.length==0)?this.dataObj:((this.dataObj[a[0]])?this.dataObj[a[0]]:"");
    },
    
    getByDataValue : function(){
        return this.dataObj[(this.dataValue?this.dataValue:"id")];
    },
    
    clearDataObj : function(){
        this.dataObj={};
    },
    setNull : function(){
        this.openFn  ="";
        this.openUrl = "";
        this.dataObj = {};
        this.setValue("");
    },
    afterTriggerClick : function(){
    }

});
Ext.reg('selectfield', Ext.form.SelectField);



//====================================================================================================
//====================================================================================================
Ext.form.SelectFieldAdvanced = Ext.extend(Ext.form.SelectField,  {
    
    readOnly : false,
    minValue : null,
    maxValue : null,
    invalidText : "{0} is not a valid date - it must be in the format {1}",
    triggerClass : 'x-form-select-trigger',
    defaultAutoCreate : {tag: "input", type: "text", width:130,size: "4", autocomplete: "off"},
    showValue : "",
    
    openUrl : "",
    dataObj : {},
    nameWidth : 100,
    nameFlag : true,
    codeFlag : true,
    
    initComponent : function(){
        //debugger;
        Ext.form.SelectFieldAdvanced.superclass.initComponent.call(this);

        this.addEvents("beforeclick");
        this.addEvents("datachange");
        this.addEvents("afterclick");
        
    },
    initEvents : function(){    
        this.el.on("keypress", this.myKeyFn,  this);
        this.el.on("focus", this.onFocus,  this);
        this.el.on("blur", this.triggerBlur,  this);
    },
    
    onResize : function(w, h){
        
        //debugger;
        Ext.form.TriggerField.superclass.onResize.call(this, w, h);
        if(typeof w == 'number'){
            this.advanced.setWidth(250);
            this.el.setWidth(this.adjustWidth('input', w - 4-this.trigger.getWidth()-this.advanced.getWidth()));
            //this.el.setWidth(this.adjustWidth('input', w - this.trigger.getWidth()-this.advanced.getWidth()));
        }
        this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth()+this.advanced.getWidth()+4);
    },
    hideName : function(){
        this.advanced.setDisplayed(false);
        this.nameFlag = false;
        if(!this.codeFlag)  this.space1.setWidth(39);
    },
    showName : function(){
        this.advanced.setDisplayed(true);
        this.nameFlag = true;
        this.space1.setWidth(2);
    },
    hideCode : function(){
        this.el.setDisplayed(false);
        this.codeFlag = false;
        if(!this.nameFlag)  this.space1.setWidth(39);
    },
    showCode : function(){
        this.el.setDisplayed(true);
        this.codeFlag = true;
        this.space1.setWidth(2);
    },
    hideAll: function(){
        this.hideCode();
        this.hideName();
    },
    showAll: function(){
        this.showCode();
        this.showName();
    },
    
    
    setAdvanced : function(value){
        this.advanced.dom.value = value;
    },
    getAdvanced : function(){
        return this.advanced.dom.value;
    },
    
    onRender : function(ct, position){
        Ext.form.TriggerField.superclass.onRender.call(this, ct, position);
        //debugger;
        this.wrap = this.el.wrap({cls: "x-form-field-wrap"});
        
        this.space1 = this.wrap.createChild({tag: "input", readonly:true,type:'text',style:'width:2;border:none;',cls: ""});
        this.trigger = this.wrap.createChild(this.triggerConfig ||
                {tag: "input", type:'button',style:'width:17;',cls: "x-form-text x-form-field x-form-sa"});
        if(this.hideTrigger){
            this.trigger.setDisplayed(false);
        }
            
        this.space2 = this.wrap.createChild({tag: "input", readonly:true,type:'text',style:'width:2;border:none;',cls: ""});
        this.advanced = this.wrap.createChild(this.advancedConfig || 
            {tag: "input", type:'text', readonly:true,size:10, cls: "x-form-text x-form-field ", autocomplete: "off"});
        
        this.initTrigger();
        if(!this.width){
            this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth()+this.advanced.getWidth());
        }
    }
});
Ext.reg('selectfieldadvanced', Ext.form.SelectFieldAdvanced);

//====================================================================================================
//====================================================================================================
Ext.grid.RadioSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
    header: '<div class="x-grid3-hd-radio">&#160;</div>',
    width: 20,
    sortable: false,

    fixed:true,
    dataIndex: '',
    id: 'checker',

    initEvents : function(){
        Ext.grid.RadioSelectionModel.superclass.initEvents.call(this);
        this.grid.on('render', function(){
            var view = this.grid.getView();
            view.mainBody.on('mousedown', this.onMouseDown, this);
            Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);

        }, this);
    },

    // private
    onMouseDown : function(e, t){
        if(t.className == 'x-grid3-row-radio'){
            e.stopEvent();
            var row = e.getTarget('.x-grid3-row');
            if(row){
                var index = row.rowIndex;
                if(this.isSelected(index)){
                    this.deselectRow(index);
                }else{
                    this.selectRow(index, true);
                }
            }
        }
    },

    // private
    onHdMouseDown : function(e, t){
        if(t.className == 'x-grid3-hd-radio'){
            e.stopEvent();
            var hd = Ext.fly(t.parentNode);
            var isChecked = hd.hasClass('x-grid3-hd-radio-on');
            if(isChecked){
                hd.removeClass('x-grid3-hd-radio-on');
                this.clearSelections();
            }else{
                hd.addClass('x-grid3-hd-radio-on');
                this.selectAll();
            }
        }
    },

    // private
    renderer : function(v, p, record){
        return '<div class="x-grid3-row-radio">&#160;</div>';
    }
});


Ext.override(Ext.data.Connection,{
    timeout : 60000
});
Ext.override(Ext.form.ComboBox,{
    maxHeight:200
});

//=======================================================================================================
//=======================================================================================================
Ext.override(Ext.form.ComboBox,{
    initComponent : function(){
        Ext.form.ComboBox.superclass.initComponent.call(this);
        this.addEvents('beforeclick','expand','collapse','beforeselect','select','beforequery','aftersetvalue');
        if(this.transform){
            this.allowDomMove = false;
            var s = Ext.getDom(this.transform);
            if(!this.hiddenName){
                this.hiddenName = s.name;
            }
            if(!this.store){
                this.mode = 'local';
                var d = [], opts = s.options;
                for(var i = 0, len = opts.length;i < len; i++){
                    var o = opts[i];
                    var value = (Ext.isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text;
                    if(o.selected) {this.value = value;}
                    d.push([value, o.text]);
                }
                this.store = new Ext.data.SimpleStore({'id': 0,fields: ['value', 'text'],data : d});
                this.valueField = 'value';
                this.displayField = 'text';
            }
            s.name = Ext.id();             if(!this.lazyRender){
                this.target = true;
                this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
                Ext.removeNode(s);                 this.render(this.el.parentNode);
            }else{
                Ext.removeNode(s);             
            }
        }
        this.selectedIndex = -1;
        if(this.mode == 'local'){
            if(this.initialConfig.queryDelay === undefined){
                this.queryDelay = 10;
            }
            if(this.initialConfig.minChars === undefined){
                this.minChars = 0;
            }
        }
    },
    setValue : function(v){
        //debugger;
        var text = ((typeof v)=='object')?v.t:v;
        v = ((typeof v)=='object')?v.v:v;
        
        //debugger;
        if(this.valueField){
            var r = this.findRecord(this.valueField, v);
            if(r){
                text = r.data[this.displayField];
            }else if(this.valueNotFoundText !== undefined){
                text = this.valueNotFoundText;
            }else{
                //v="";
                //text = "未选择...";
            }
        }
        this.lastSelectionText = text;
        if(this.hiddenField){
            this.hiddenField.value = v;
        }
        Ext.form.ComboBox.superclass.setValue.call(this, text);
        this.value = v;
        this.fireEvent('aftersetvalue', this, text,v);
        
    },
    onTriggerClick : function(){
        if(this.disabled){
            return;
        }

        var flag = this.fireEvent("beforeclick", this,this);
        if(!flag) return;

        if(this.isExpanded()){
            this.collapse();
            this.el.focus();
        }else {
            this.onFocus({});
            if(this.triggerAction == 'all') {
                this.doQuery(this.allQuery, true);
            } else {
                this.doQuery(this.getRawValue());
            }
            this.el.focus();
        }
    }
    
});


Ext.override(Ext.grid.RowSelectionModel,{

    initEvents : function(){
        if(!this.grid.enableDragDrop && !this.grid.enableDrag){
            this.grid.on("rowmousedown", this.handleMouseDown, this);
        }else{ // allow click to work like normal
            this.grid.on("rowclick", function(grid, rowIndex, e) {
                if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {
                    this.selectRow(rowIndex, false);
                    grid.view.focusRow(rowIndex);
                }
            }, this);
        }

        this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), {
            "up" : function(e){
                if(!e.shiftKey){
                    this.selectPrevious(e.shiftKey);
                }else if(this.last !== false && this.lastActive !== false){
                    var last = this.last;
                    this.selectRange(this.last,  this.lastActive-1);
                    this.grid.getView().focusRow(this.lastActive);
                    if(last !== false){
                        this.last = last;
                    }
                }else{
                    this.selectFirstRow();
                }
            },
            "down" : function(e){
                if(!e.shiftKey){
                    this.selectNext(e.shiftKey);
                }else if(this.last !== false && this.lastActive !== false){
                    var last = this.last;
                    this.selectRange(this.last,  this.lastActive+1);
                    this.grid.getView().focusRow(this.lastActive);
                    if(last !== false){
                        this.last = last;
                    }
                }else{
                    this.selectFirstRow();
                }
            },
            scope: this
        });

        var view = this.grid.view;
        view.on("refresh", this.onRefresh, this);
        view.on("rowupdated", this.onRowUpdated, this);
        view.on("rowremoved", this.onRemove, this);
    },

    handleMouseDown : function(g, rowIndex, e){
        //debugger;
        if(e.button !== 0 || this.isLocked()){
            return;
        };
        var view = this.grid.getView();
        if(e.shiftKey && this.last !== false){
            var last = this.last;
            this.selectRange(last, rowIndex, e.ctrlKey);
            this.last = last; // reset the last
            view.focusRow(rowIndex);
        }else{
            var isSelected = this.isSelected(rowIndex);
            if(e.ctrlKey && isSelected){
                this.deselectRow(rowIndex);
            }else if(!isSelected || this.getCount() > 1){
                this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);
                view.focusRow(rowIndex);
            }
        }
    },
    
    selectRow : function(index, keepExisting, preventViewNotify,stopEvent){
        //debugger;
        if(this.locked || (index < 0 || index >= this.grid.store.getCount())) return;
        var r = this.grid.store.getAt(index);
        if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){
            if(!keepExisting || this.singleSelect){
                this.clearSelections();
            }
            this.selections.add(r);
            this.last = this.lastActive = index;
            //debugger;
            if(!preventViewNotify){
                this.grid.getView().onRowSelect(index);
            }
            if(!stopEvent){
                this.fireEvent("rowselect", this, index, r);
                this.fireEvent("selectionchange", this);
            }
        }
    },
    deselectRow : function(index, preventViewNotify){
        if(this.locked) return;
        if(this.last == index){
            this.last = false;
        }
        if(this.lastActive == index){
            this.lastActive = false;
        }
        var r = this.grid.store.getAt(index);
        if(r){
            this.selections.remove(r);
            if(!preventViewNotify){
                this.grid.getView().onRowDeselect(index);
            }
            this.fireEvent("rowdeselect", this, index, r);
            this.fireEvent("selectionchange", this);
        }
    }
});

/*
Ext.override(Ext.grid.CheckboxSelectionModel,{
    onMouseDown : function(e, t){
        if(t.className == 'x-grid3-row-checker'){
            e.stopEvent();
            var row = e.getTarget('.x-grid3-row');
            if(row){
                var index = row.rowIndex;
                if(this.isSelected(index)){
                    this.deselectRow(index);
                }else{
                    this.selectRow(index, true);
                }
            }
        }
    }
});
*/
//=======================================================================================================
//=======================================================================================================
Ext.override(Ext.grid.EditorGridPanel,{
    startEditing : function(row, col){
        if(sc.isView()) return;
        //debugger;
        this.stopEditing();
        if(this.colModel.isCellEditable(col, row)){
            this.view.ensureVisible(row, col, true);
            var r = this.store.getAt(row);
            var field = this.colModel.getDataIndex(col);
            var e = {
                grid: this,
                record: r,
                field: field,
                value: r.data[field],
                row: row,
                column: col,
                cancel:false
            };
            if(this.fireEvent("beforeedit", e) !== false && !e.cancel){
                this.editing = true;
                var ed = this.colModel.getCellEditor(col, row);
                if(!ed.rendered){
                    ed.render(this.view.getEditorParent(ed));
                }
                (function(){ // complex but required for focus issues in safari, ie and opera
                    ed.row = row;
                    ed.col = col;
                    ed.record = r;
                    ed.field.lastQuery = undefined;         //扩展
                    
                    ed.on("complete", this.onEditComplete, this, {single: true});
                    ed.on("specialkey", this.selModel.onEditorKey, this.selModel);
                    this.activeEditor = ed;
                    var v = r.data[field];

                    var _type=ed.field.getXType();
                    var _text = null;
                    if(_type=='combo'){
                        var nameIndex = e.grid.colModel.config[col].nameIndex;
                        if(nameIndex){
                            _text = r.data[nameIndex];
                        }
                    }

                    if(_text!=null){
                        var o = {v:v,t:_text};
                        ed.startEdit(this.view.getCell(row, col), o);
                    }
                    else
                        ed.startEdit(this.view.getCell(row, col), v);
                }).defer(10, this);
            }
        }
    }
});

Ext.override(Ext.Editor,{
    startEdit : function(el, value){
        //debugger;
        
        if(this.editing){
            this.completeEdit();
        }
        this.boundEl = Ext.get(el);

        if((typeof value)=='object'){           //扩展
            var v = value.v !== undefined ? value.v : this.boundEl.dom.innerHTML;
        }else
            var v = value !== undefined ? value : this.boundEl.dom.innerHTML;
            
            
        if(!this.rendered){
            this.render(this.parentEl || document.body);
        }
        if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){
            return;
        }
        this.startValue = v;
        
        if((typeof value)=='object'){           //扩展
            this.field.setValue(value);
        }else{
            this.field.setValue(v);
        }
        
        if(this.autoSize){
            var sz = this.boundEl.getSize();
            switch(this.autoSize){
                case "width":
                this.setSize(sz.width,  "");
                break;
                case "height":
                this.setSize("",  sz.height);
                break;
                default:
                this.setSize(sz.width,  sz.height);
            }
        }
        this.el.alignTo(this.boundEl, this.alignment);
        this.editing = true;
        this.show();
    },
    completeEdit : function(remainVisible){
        //debugger;
        if(!this.editing){
            return;
        }
        var v = this.getValue();
        if(this.revertInvalid !== false && !this.field.isValid()){
            v = this.startValue;
            this.cancelEdit(true);
        }
        if(String(v) === String(this.startValue) && this.ignoreNoChange){
            this.editing = false;
            this.hide();
            return;
        }
        if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){
            this.editing = false;
            if(this.updateEl && this.boundEl){
                this.boundEl.update(v);
            }
            if(remainVisible !== true){
                this.hide();
            }
            this.fireEvent("complete", this, v, this.startValue);
        }
    },
    
    onShow : function(){

        this.el.show();
        if(this.hideEl !== false){
            this.boundEl.hide();
        }
        this.field.show();
        if(Ext.isIE && !this.fixIEFocus){ // IE has problems with focusing the first time
            this.fixIEFocus = true;
            this.deferredFocus.defer(10, this);
        }else{
            this.field.focus();

            var xtype = this.field.getXType();
            if(xtype=='combo' || xtype=='datefield' )
                this.field.onTriggerClick();
            
        }
        this.fireEvent("startedit", this.boundEl, this.startValue);
    },
    deferredFocus : function(){
        if(this.editing){
            this.field.focus();

            var xtype = this.field.getXType();
            if(xtype=='combo' || xtype=='datefield' )
                this.field.onTriggerClick();
        }
    },
    onHide : function(){
        //debugger;
        if(this.editing){
            this.completeEdit();
            return;
        }
        this.field.blur();
        if(this.field.collapse){
            this.field.collapse();
        }
        this.el.hide();
        if(this.hideEl !== false){
            this.boundEl.show();
        }
    }
    
});


Ext.override(Ext.grid.RowSelectionModel,{
    getLastSelected : function(){
        return this.selections.itemAt(this.selections.items.length-1);
    }
});

Ext.override(Ext.data.Record,{
    get : function(name){
        if(name.indexOf(".")!=-1)
            return this.data[name.replaceAll(".","__")];
        else
            return this.data[name]; 
    },
    set : function(name, value){
        if(String(this.data[name]) == String(value)){
            return;
        }
        this.dirty = true;
        if(!this.modified){
            this.modified = {};
        }
        if(typeof this.modified[name] == 'undefined'){
            this.modified[name] = this.data[name];
        }
        this.data[name] = value;
        if(!this.editing){
            this.store.afterEdit(this);
        }       
    }
});


//=======================================================================================================
//重载 以识别正确的空的返回
//=======================================================================================================
Ext.override(Ext.data.HttpProxy,{
    loadResponse : function(o, success, response){
        //debugger;
        delete this.activeRequest;
        if(!success){
            this.fireEvent("loadexception", this, o, response);
            o.request.callback.call(o.request.scope, null, o.request.arg, false);
            return;
        }
        var result;
        try {
            result = o.reader.read(response);
        }catch(e){
            //debugger;
            try{
                var getData = eval("("+response.responseText+")");
                o.request.arg.datasetFlag = (getData.dataset.response.success=="true")?true:false;;
            }catch(e){
                o.request.arg.errorInfo = "JSON转换异常 或 没有找到dataset.response.success标志！"
            }
            
            this.fireEvent("loadexception", this, o, response, e);
            o.request.callback.call(o.request.scope, null, o.request.arg, false);
            return;
        }
        this.fireEvent("load", this, o, o.request.arg);
        o.request.callback.call(o.request.scope, result, o.request.arg, true);
    }
});

//=======================================================================================================
//重载 以适应单调记录返回
//=======================================================================================================
Ext.override(Ext.data.JsonReader,{
    readRecords:function(o){
        this.jsonData = o;
        var s = this.meta, Record = this.recordType,
            f = Record.prototype.fields, fi = f.items, fl = f.length;


        if (!this.ef) {
            if(s.totalProperty) {
	            this.getTotal = this.getJsonAccessor(s.totalProperty);
	        }
	        if(s.successProperty) {
	            this.getSuccess = this.getJsonAccessor(s.successProperty);
	        }
	        this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;};
	        if (s.id) {
	        	var g = this.getJsonAccessor(s.id);
	        	this.getId = function(rec) {
	        		var r = g(rec);
		        	return (r === undefined || r === "") ? null : r;
	        	};
	        } else {
	        	this.getId = function(){return null;};
	        }
            this.ef = [];
            for(var i = 0; i < fl; i++){
                f = fi[i];
                var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;
                this.ef[i] = this.getJsonAccessor(map);
            }
        }
        
    	var root = this.getRoot(o);
    	var c = (root.length)?root.length:1, totalRecords = c, success = true;
    	if(s.totalProperty){
            var v = parseInt(this.getTotal(o), 10);
            if(!isNaN(v)){
                totalRecords = v;
            }
        }
        if(s.successProperty){
            var v = this.getSuccess(o);
            if(v === false || v === 'false'){
                success = false;
            }
        }
        var records = [];
	    for(var i = 0; i < c; i++){
		    var n = (c==1)?root:root[i];
	        var values = {};
	        var id = this.getId(n);
	        for(var j = 0; j < fl; j++){
	            f = fi[j];
                var v = this.ef[j](n);
                values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue);
	        }
	        var record = new Record(values, id);
	        record.json = n;
	        records[i] = record;
	    }
	    
	    return {
	        success : success,
	        records : records,
	        totalRecords : totalRecords
	    };
    }
});






//=================================================================================================
//本地化
//=================================================================================================
Ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">加载中...</div>';
if(Ext.View){Ext.View.prototype.emptyText = "";}
if(Ext.grid.Grid){Ext.grid.Grid.prototype.ddText = "{0} 选择行";}
if(Ext.TabPanelItem){Ext.TabPanelItem.prototype.closeText = "关闭";}
if(Ext.form.Field){Ext.form.Field.prototype.invalidText = "输入值非法";}
Date.monthNames = ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];
Date.dayNames = ["日","一","二","三","四","五","六"];
if(Ext.MessageBox){
   Ext.MessageBox.buttonText = {
      ok     : "确定",
      cancel : "取消",
      yes    : "是",
      no     : "否"
   };
}
if(Ext.util.Format){
   Ext.util.Format.date = function(v, format){
      if(!v) return "";
      if(!(v instanceof Date)) v = new Date(Date.parse(v));
      return v.dateFormat(format || "y年m月d日");
   };
}
if(Ext.DatePicker){
   Ext.apply(Ext.DatePicker.prototype, {
      todayText         : "今天",
      minText           : "日期在最小日期之前",
      maxText           : "日期在最大日期之后",
      disabledDaysText  : "",
      disabledDatesText : "",
      monthNames        : Date.monthNames,
      dayNames          : Date.dayNames,
      nextText          : '下月 (Control+Right)',
      prevText          : '上月 (Control+Left)',
      monthYearText     : '选择一个月 (Control+Up/Down 来改变年)',
      todayTip          : "{0} (空格键选择)",
      format            : "y年m月d日",
      okText            : "确定",
      cancelText        : "取消"
   });
}
if(Ext.PagingToolbar){
   Ext.apply(Ext.PagingToolbar.prototype, {
      beforePageText : "第",
      afterPageText  : "页共 {0} 页",
      firstText      : "第一页",
      prevText       : "前一页",
      nextText       : "下一页",
      lastText       : "最后页",
      refreshText    : "刷新",
      displayMsg     : "显示 {0} - {1}，共 {2} 条",
      emptyMsg       : '没有数据需要显示'
   });
}
if(Ext.form.TextField){
   Ext.apply(Ext.form.TextField.prototype, {
      minLengthText : "该输入项的最小长度是 {0}",
      maxLengthText : "该输入项的最大长度是 {0}",
      blankText     : "该输入项为必输项",
      regexText     : "",
      emptyText     : null
   });
}
if(Ext.form.NumberField){
   Ext.apply(Ext.form.NumberField.prototype, {
      minText : "该输入项的最小值是 {0}",
      maxText : "该输入项的最大值是 {0}",
      nanText : "{0} 不是有效数值"
   });
}
if(Ext.form.DateField){
   Ext.apply(Ext.form.DateField.prototype, {
      disabledDaysText  : "禁用",
      disabledDatesText : "禁用",
      minText           : "该输入项的日期必须在 {0} 之后",
      maxText           : "该输入项的日期必须在 {0} 之前",
      invalidText       : "{0} 是无效的日期 - 必须符合格式： {1}",
      format            : "y年m月d日"
   });
}
if(Ext.form.ComboBox){
   Ext.apply(Ext.form.ComboBox.prototype, {
      loadingText       : "加载...",
      valueNotFoundText : undefined
   });
}
if(Ext.form.VTypes){
   Ext.apply(Ext.form.VTypes, {
      emailText    : '该输入项必须是电子邮件地址，格式如： "user@domain.com"',
      urlText      : '该输入项必须是URL地址，格式如： "http:/'+'/www.domain.com"',
      alphaText    : '该输入项只能包含字符和_',
      alphanumText : '该输入项只能包含字符,数字和_'
   });
}
if(Ext.grid.GridView){
   Ext.apply(Ext.grid.GridView.prototype, {
      sortAscText  : "正序",
      sortDescText : "逆序",
      lockText     : "锁列",
      unlockText   : "解锁列",
      columnsText  : "列"
   });
}
if(Ext.grid.PropertyColumnModel){
   Ext.apply(Ext.grid.PropertyColumnModel.prototype, {
      nameText   : "名称",
      valueText  : "值",
      dateFormat : "y年m月d日"
   });
}
if(Ext.layout.BorderLayout.SplitRegion){
   Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype, {
      splitTip            : "拖动来改变尺寸.",
      collapsibleSplitTip : "拖动来改变尺寸. 双击隐藏."
   });
}

//=================================================================================================
//处理blank image
//=================================================================================================
function getBlankImgPath(allPath){
    
    var infos = allPath.split("/");
    var imgPath = "support/resources/images/default/s.gif";
    
    var begin = (infos[0]=="")?1:0;
    var blankImgPath = "/";
    
    for(var i=begin;i<infos.length;i++){
        if(infos[i]=='WebContent') {
            blankImgPath+=infos[i]+'/';
            break;
        }
        else if(infos[i]=='business'){
            //blankImgPath+='WebContent/';
            break;
        }else{
            blankImgPath+=infos[i]+'/';
        }
    }
    
    //debugger;
    blankImgPath +=imgPath;
    Ext.BLANK_IMAGE_URL =  blankImgPath;   
}
getBlankImgPath(window.location.pathname);
//Ext.BLANK_IMAGE_URL = '/' + window.location.pathname.split('/', 2)[1] + '/support/resources/images/default/s.gif';
//Ext.BLANK_IMAGE_URL= '../../ext2/resources/images/default/s.gif';

